package tclp.simpleocr;

import java.awt.image.BufferedImage;
import java.io.BufferedWriter;
import java.util.ArrayList;
import java.util.HashMap;
import net.sourceforge.javaocr.ocrPlugins.mseOCR.OCRScanner;
import net.sourceforge.javaocr.ocrPlugins.mseOCR.TrainingImage;

/**
 *
 * @author Absatz Leoš
 */
public class OCRWrapper {

    protected OCRScanner ocrScanner;

    public OCRWrapper(HashMap<Character, ArrayList<TrainingImage>> trainingImages) {
        ocrScanner = new OCRScanner();
        ocrScanner.addTrainingImages(trainingImages);
    }

    public String run(BufferedImage image, BufferedWriter writer) throws Exception {
        String text = ocrScanner.scan(image, 0, 0, 0, 0, null);
        return text;
    }
}
